import request from '@/utils/request'

export default {
  // 添加
  create(data) {
    return request({
      url: `/v1/purchase/purchase-process/create`,
      method: 'post',
      data
    })
  },
  // 编辑
  edit(data) {
    return request({
      url: `/v1/purchase/purchase-process/edit`,
      method: 'post',
      data
    })
  },
  // 明细
  detail(params) {
    return request({
      url: `/v1/purchase/purchase-process/detail`,
      method: 'get',
      params
    })
  },
  // 拆分
  split(data) {
    return request({
      url: `/v1/purchase/purchase-process/split`,
      method: 'post',
      data
    })
  },
  // 退回
  back(data) {
    return request({
      url: `/v1/purchase/purchase-process/back`,
      method: 'post',
      data
    })
  },
  // 1688产品详情
  detail1688(data) {
    return request({
      url: `/v1/product/product/detail`,
      method: 'post',
      data
    })
  },
  // 匹配1688sku
  match(params) {
    return request({
      url: `/v1/product/product/match`,
      method: 'get',
      params
    })
  },
  // 1688收货地址
  address(params) {
    return request({
      url: `/v1/purchase/purchase-process/deliver-address`,
      method: 'get',
      params
    })
  },
  // 1688下单
  order(data) {
    return request({
      url: `/v1/purchase/purchase-process/order`,
      method: 'post',
      data
    })
  },
  // 获取选中SKU
  getSku(data) {
    return request({
      url: `/v1/purchase/purchase-process/get-sku`,
      method: 'post',
      data
    })
  },
  // 获取选中明细(生成采购单使用)
  getDetail(data) {
    return request({
      url: `/v1/purchase/purchase-order/get-detail`,
      method: 'post',
      data
    })
  },
  // 获取供应商收款账户
  getSupplier(data) {
    return request({
      url: `/v1/purchase/purchase-order/get-supplier-collect`,
      method: 'post',
      data
    })
  },
  // 获取交易方式
  getPaymentType(data) {
    return request({
      url: `/v1/purchase/purchase-process/get-trade-type`,
      method: 'post',
      data
    })
  },
  // 批量提交
  submit(data) {
    return request({
      url: `/v1/purchase/purchase-process/batch-submit`,
      method: 'post',
      data,
      returnData: true
    })
  },
}
